<!-- 搜索表单 -->
<template>
  <ele-card :body-style="{ paddingBottom: '2px' }">
    <el-form label-width="72px" @keyup.enter="search" inline>
      <el-form-item label="分类">
        <el-radio-group v-model="form.cate" @change="search">
          <!-- <el-radio-button label="自动计划">自动计划</el-radio-button> -->
          <el-radio-button label="人工申请">
            人工申请
            <span v-if="badgeData.apply > 0" class="red my-badge">{{
              badgeData.apply
            }}</span>
          </el-radio-button>
          <el-radio-button label="重新报价">
            重新报价
            <span v-if="badgeData.reoffer > 0" class="red my-badge">{{
              badgeData.reoffer
            }}</span>
          </el-radio-button>
        </el-radio-group>
      </el-form-item>

      <br />
      <el-form-item label="车牌号码">
        <el-input v-model.trim="form.plate_number" />
      </el-form-item>
      <el-form-item label="车队名称">
        <el-input v-model.trim="form.company" />
      </el-form-item>

      <el-form-item label-width="16px">
        <el-button type="primary" @click="search">查询</el-button>
      </el-form-item>
    </el-form>
  </ele-card>
</template>

<script setup>
  import { ref } from 'vue';

  import { useFormData } from '@/utils/use-form-data';

  const emit = defineEmits(['search']);
  const props = defineProps({
    action: String,
    badgeData: Object
  });
  /** 表单数据 */
  const [form] = useFormData({
    company: '',
    area_id: 0,
    plate_number: '',
    cate: '人工申请',
    choose_status: 1
  });

  /** 搜索 */
  const search = () => {
    console.log(form);
    emit('search', { ...form });
  };
</script>
